package com.jftone.bh.app.action;

import com.jftone.bh.app.config.SysConst;
import com.jftone.bh.app.model.NtbVipCard;
import com.jftone.bh.app.service.VipOrderService;
import com.jftone.bh.app.service.VipTradeService;
import org.apache.log4j.Logger;
import org.jftone.annotation.Autowired;
import org.jftone.annotation.Controller;
import org.jftone.exception.ActionException;
import org.jftone.util.IData;

import java.util.List;


@Controller(mapping="/vipOrderAction")
public class VipOrderAction extends BaseAction {

	private Logger logger = Logger.getLogger(VipOrderAction.class);
	
	@Autowired
	private VipOrderService service;

	public void query() throws ActionException {
		IData<String, Object> data = getData();
		String account = data.getString("account", "");
		String orderNo = data.getString("orderNo", "");
		String status = data.getString("status", "");
		String cardId = data.getString("cardId", "");
		String userId = data.getString("userId", "");
		String sTime = data.getString("sTime", "");
		String eTime = data.getString("eTime", "");
		this.putRenderInfo("sTime", sTime);
		this.putRenderInfo("eTime", eTime);
		this.putRenderInfo("userId", userId);
		this.putRenderInfo("status", status);
		this.putRenderInfo("orderNo", orderNo);
		this.putRenderInfo("account", account);
		this.putRenderInfo("cardId", cardId);
		try {
			//设置功能按钮
			setMenuFuncDerictive();
			//设置分页组件
			setPageDerictive();
			putParam("sTime", sTime);
			putParam("eTime", eTime);
			putParam("userId", userId);
			putParam("account", account);
			putParam("orderNo", orderNo);
			putParam("cardId", cardId);
			putParam("status", status);
			putParam(SysConst.QUERY_PARAMS, getParam());

			List<NtbVipCard> cardList = service.queryNtbVipCardList();
			List<IData<String, Object>> list = service.queryList(data, getPage());
			this.putRenderInfo("list", list);
			this.putRenderInfo("cardList", cardList);
			this.render("order/order_list.html");
		} catch (Exception e) {
			logger.error("查询VIP订单列表错误" + e.getMessage(), e);
			throw new ActionException("查询VIP订单列表错误" + e.getMessage(), e);
		}
	}


}
